package com.lxy.dataservice.controller;

import com.coxautodev.graphql.tools.GraphQLMutationResolver;
import com.coxautodev.graphql.tools.GraphQLQueryResolver;
import com.lxy.dataservice.entity.Member;
import com.lxy.dataservice.service.MemberService;
import com.nip.db.mongodb.utils.tips.Response;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * MemberController
 *
 * @author < a href=" ">BBB</ a>
 * @version v1.0.01
 * @date 2019-12-26 14:44
 */
@Component
public class MemberController implements GraphQLQueryResolver, GraphQLMutationResolver {
  @Autowired
  MemberService memberService;

  public Response saveMember(Member entity) {
    return memberService.saveMember(entity);
  }

  public List<Member> findAllMember() {
    return memberService.findAllMember();
  }

  public Member findMemberById(String id) {
    return memberService.findById(id);
  }

  public Response deleteMemberById(String id) {
    return memberService.deleteById(id);
  }

  public List<Member> findMemberByCardNumber(String cardNumber){
    return memberService.findAllByCardNumber(cardNumber);
  }

}
